﻿using Bll;
using StackExchange.Redis;
using System;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;

namespace Vote
{
    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            //AreaRegistration.RegisterAllAreas();
           // FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
            log4net.Config.XmlConfigurator.Configure();
            //BllVoteNumber.InsertAllToRedis(); //改成管理后台手动更新
            //BllVoteNumber.InsertSubcribeToRedis();
        }

        protected void Session_Start(object sender, EventArgs e)
        {
            //测试的时候，设置session的过期时间为一周
            HttpContext.Current.Session.Timeout = 10080;
        }

        protected void Session_End(object sender, EventArgs e)
        {
            HttpContext.Current.Session.Clear();
        }
    }
}
